//
//  recordMenuItem.m
//  SoundPill
//
//  Created by 宋旭东 on 15/7/24.
//  Copyright (c) 2015年 宋旭东. All rights reserved.
//

#import "recordMenuItem.h"
#import "UIViewExt.h"
@implementation recordMenuItem
- (instancetype)initWithFrame:(CGRect)frame isScene:(BOOL)isScene
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        if (isScene == NO) {
            self.contentImage = [[UIImageView alloc] initWithFrame:CGRectMake(20, 0, frame.size.width - 40, frame.size.width - 40)];
            [self.layer addSublayer:_contentImage.layer];
            self.contentTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, _contentImage.bottom - 10, frame.size.width, frame.size.height - _contentImage.height)];
            [self.layer addSublayer:_contentTitle.layer];
            _contentTitle.textColor = [UIColor whiteColor];
            _contentTitle.textAlignment = NSTextAlignmentCenter;
            
//            self.maskLable =[[UILabel alloc] initWithFrame: _contentTitle.frame];
//            _maskLable.text = @"快速录制";
//            _maskLable.textColor = [UIColor whiteColor];
//            _maskLable.textAlignment = NSTextAlignmentCenter;
//            [self.layer addSublayer:_maskLable.layer];
            
        } else {
//            self.backgroundColor = [UIColor redColor];
            self.contentImage = [[UIImageView alloc] initWithFrame:CGRectMake(self.width / 2 - self.height, 0, self.height, self.height)];
            _contentImage.center = CGPointMake(self.width / 4, _contentImage.center.y);
            [self.layer addSublayer:_contentImage.layer];
            self.contentTitle = [[UILabel alloc] initWithFrame:CGRectMake(self.width / 2, 0, self.width / 4, self.height)];
//            _contentTitle.backgroundColor = [UIColor brownColor];
            [self.layer addSublayer:_contentTitle.layer];
            _contentTitle.textColor = [UIColor whiteColor];
            _contentTitle.textAlignment = NSTextAlignmentCenter;
        }
    }
    return self;
}
- (void)setMaskLableHidden:(BOOL)hidden
{
//    if (hidden == YES) {
//        _maskLable.hidden = hidden;
//        _contentTitle.frame = CGRectMake(0, _contentImage.bottom - 10, self.width, self.height - _contentImage.height);
//        _contentTitle.font = [UIFont systemFontOfSize:17];
//    } else {
//        _maskLable.hidden = hidden;
//        _contentTitle.text = [NSString stringWithFormat:@"（%@）",_contentTitle.text];
//        _contentTitle.frame = CGRectMake(0, _maskLable.bottom - 40, self.width, self.height - _contentImage.height);
//        _contentTitle.font = [UIFont systemFontOfSize:14];
//    }
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
